import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.TreeSet;


public class ShipDemo {

	public static void main(String[] args) {
		
		ShipComparator comparator = new ShipComparator();
		ArrayList<ArrayList<Ship>> list = new ArrayList<ArrayList<Ship>>();
	
		
		Ship sh = new Ship(400, 7, "Titanic");
		Ship sh1 = new Ship(49, 7, "Santa Marina");
		Ship sh2 = new Ship(40, 7, "Queen Steania");
		Collections.addAll(list, sh1,sh2,sh,5);
		
		
		
//		TreeSet set = new TreeSet(comparator);
		//System.out.println(sh.hashCode());
		LinkedHashSet set = new LinkedHashSet<>();
		Collections.addAll(set, sh1,sh2,sh);
		
		//System.out.println(Collections.);
		
		System.out.println(Collections.binarySearch(list, sh,comparator));
		
		
//		set.add(sh);
//		set.add(sh1);
//		set.add(sh2);
		
		

		Map<String, Ship> map = new HashMap<String, Ship>();
		map.put("Titanic", sh);
		map.put("Santa", sh1);
		map.put("Stefania", sh2);
		map.put("Titanic", sh2);
		
		map.remove("Titanic");
	
		
		
		for (Iterator it = map.keySet().iterator(); it.hasNext(); ) {
			String key = (String)it.next();
			
			System.out.println(key);
			System.out.println(map.get(key));
		}
		
		
	}
}
